package com.wz.project.sap.DN_POST_DN.service.impl;

import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wz.project.sap.DN_POST_DN.mapper.ZflWmsDnPostDnMapper;
import com.wz.project.sap.DN_POST_DN.domain.ZflWmsDnPostDn;
import com.wz.project.sap.DN_POST_DN.service.IZflWmsDnPostDnService;
import com.wz.common.utils.text.Convert;

/**
 * 内外向交货单过账Service业务层处理
 * 
 * @author wz
 * @date 2022-09-19
 */
@Service
public class ZflWmsDnPostDnServiceImpl implements IZflWmsDnPostDnService 
{
    @Autowired
    private ZflWmsDnPostDnMapper zflWmsDnPostDnMapper;

    /**
     * 查询内外向交货单过账
     * 
     * @param ZEILE 内外向交货单过账ID
     * @return 内外向交货单过账
     */
    @Override
    public ZflWmsDnPostDn selectZflWmsDnPostDnById(String ZEILE)
    {
        return zflWmsDnPostDnMapper.selectZflWmsDnPostDnById(ZEILE);
    }

    @Override
    public List<ZflWmsDnPostDn> selectZflWmsDnPostDnByOrder(String VBELN) {
        return zflWmsDnPostDnMapper.selectZflWmsDnPostDnByOrder(VBELN);
    }

    /**
     * 查询内外向交货单过账列表
     * 
     * @param zflWmsDnPostDn 内外向交货单过账
     * @return 内外向交货单过账
     */
    @Override
    public List<ZflWmsDnPostDn> selectZflWmsDnPostDnList(ZflWmsDnPostDn zflWmsDnPostDn)
    {
        return zflWmsDnPostDnMapper.selectZflWmsDnPostDnList(zflWmsDnPostDn);
    }
    @Override
    public ZflWmsDnPostDn selectZflWmsDnPostDn(ZflWmsDnPostDn zflWmsDnPostDn)
    {
        return zflWmsDnPostDnMapper.selectZflWmsDnPostDn(zflWmsDnPostDn);
    }
    /**
     * 新增内外向交货单过账
     * 
     * @param zflWmsDnPostDn 内外向交货单过账
     * @return 结果
     */
    @Override
    public int insertZflWmsDnPostDn(ZflWmsDnPostDn zflWmsDnPostDn)
    {
        return zflWmsDnPostDnMapper.insertZflWmsDnPostDn(zflWmsDnPostDn);
    }

    /**
     * 修改内外向交货单过账
     * 
     * @param zflWmsDnPostDn 内外向交货单过账
     * @return 结果
     */
    @Override
    public int updateZflWmsDnPostDn(ZflWmsDnPostDn zflWmsDnPostDn)
    {
        return zflWmsDnPostDnMapper.updateZflWmsDnPostDn(zflWmsDnPostDn);
    }

    @Override
    public int updateZflWmsDnPostDnStatus(ZflWmsDnPostDn zflWmsDnPostDn) {
        return zflWmsDnPostDnMapper.updateZflWmsDnPostDnStatus(zflWmsDnPostDn);
    }

    @Override
    public int updateZflWmsDnPostDnZJ(ZflWmsDnPostDn zflWmsDnPostDn) {
        return zflWmsDnPostDnMapper.updateZflWmsDnPostDnZJ(zflWmsDnPostDn);
    }
    @Override
    public int editStatus(ZflWmsDnPostDn zflWmsDnPostDn) {
        return zflWmsDnPostDnMapper.editStatus(zflWmsDnPostDn);
    }

    /**
     * 删除内外向交货单过账对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteZflWmsDnPostDnByIds(String ids)
    {
        return zflWmsDnPostDnMapper.deleteZflWmsDnPostDnByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除内外向交货单过账信息
     * 
     * @param ZEILE 内外向交货单过账ID
     * @return 结果
     */
    @Override
    public int deleteZflWmsDnPostDnById(String ZEILE)
    {
        return zflWmsDnPostDnMapper.deleteZflWmsDnPostDnById(ZEILE);
    }

    @Override
    public List<ZflWmsDnPostDn> selectZflWmsDnPostDisticnct(String VBELN) {
        return zflWmsDnPostDnMapper.selectZflWmsDnPostDisticnct(VBELN);
    }

    @Override
    public List<ZflWmsDnPostDn> selectZflWmsDnPostDnList1(ZflWmsDnPostDn zflWmsDnPostDn) {
        List<ZflWmsDnPostDn> zflWmsDnPostDns1 = new ArrayList<>();
        List<ZflWmsDnPostDn> zflWmsDnPostDns = zflWmsDnPostDnMapper.selectZflWmsDnPostDnList1(zflWmsDnPostDn);
        for (ZflWmsDnPostDn zflWmsDnPostDn1: zflWmsDnPostDns ) {
            if(zflWmsDnPostDn1.getTYPE()==null){
                zflWmsDnPostDn1.setTYPE("1");
            }
            zflWmsDnPostDns1.add(zflWmsDnPostDn1);
        }

        return zflWmsDnPostDns1;
    }

    @Override
    public ZflWmsDnPostDn selectZflWmsDnPostDisticnctByprueflos(String prueflos) {
        return zflWmsDnPostDnMapper.selectZflWmsDnPostDisticnctByprueflos(prueflos);
    }

    @Override
    public void updateZflWmsDnPostDnZjOk(String prueflos) {
        zflWmsDnPostDnMapper.updateZflWmsDnPostDnZjOk(prueflos);
    }

    @Override
    public void updateZflWmsDnPostDnZjNo(String prueflos) {
        zflWmsDnPostDnMapper.updateZflWmsDnPostDnZjNo(prueflos);
    }

    @Override
    public ZflWmsDnPostDn selectZflWmsDnPostDnByPAI(String matnrMain, String inStockId) {
        return zflWmsDnPostDnMapper.selectZflWmsDnPostDnByPAI(matnrMain,inStockId);
    }

    @Override
    public List<ZflWmsDnPostDn> selectDistinctVBELN(ZflWmsDnPostDn zflWmsDnPostDn) {
        return zflWmsDnPostDnMapper.selectDistinctVBELN(zflWmsDnPostDn);
    }

    @Override
    public int selectZflWmsDnPostDnCount(ZflWmsDnPostDn zflWmsDnPostDn) {
        return zflWmsDnPostDnMapper.selectDistinctCount(zflWmsDnPostDn);
    }
}
